import numpy


class MarketData:
    def __init__(self, start_time, open_price, high_price, low_price, close_price, volume_contracts, volume_coin, volume_quote, kline_status):
        """
        Initializes the MarketData object with all market data points.

        :param start_time: 开始时间，Unix时间戳的毫秒数格式
        :param open_price: 开盘价格
        :param high_price: 最高价格
        :param low_price: 最低价格
        :param close_price: 收盘价格
        :param volume_contracts: 交易量（合约张数）
        :param volume_coin: 交易量（以币为单位）
        :param volume_quote: 交易量（以计价货币为单位）
        :param kline_status: K线状态（0：未完结，1：已完结）
        """
        self.start_time = start_time
        self.open_price = open_price
        self.high_price = high_price
        self.low_price = low_price
        self.close_price = close_price
        self.volume_contracts = volume_contracts
        self.volume_coin = volume_coin
        self.volume_quote = volume_quote
        self.kline_status = kline_status
        self.upperband = numpy.nan
        self.middleband = numpy.nan
        self.lowerband = numpy.nan

    def set_bollinger_bands(self, upperband, middleband, lowerband):
        self.upperband = upperband
        self.middleband = middleband
        self.lowerband = lowerband